from bs4 import BeautifulSoup
from urllib.request import urlretrieve
import requests

def geturl(urll):
    path=urll.replace('amp;','')
    return path

#https://baijiahao.baidu.com/s?id=1616033208816596609&wfr=spider&for=pc
url=input('输入链接： ')
html=requests.get(url)
bs=BeautifulSoup(html.text,'html.parser')
i=1
x=bs.find('div',{'class':'article-content'})
maolist=x.find_all(src=True)
for mao in maolist:
    maoo=geturl(mao['src'])
    urlretrieve(maoo,'{}.jpg'.format(i))
    i+=1
    print('{}.jpg'.format(i),'下载成功')
